home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / WINRES / BITMAP.PAS < prev    next >
Pascal/Delphi Source File  |  1994-09-15  |  1KB  |  46 lines

  1. unit Bitmap;
  2.  
  3. { Unit Bitmap, Copr. 1994 Matthias Köppe
  4.  
  5.   Translate a device-independent bitmap, loaded by LoadBitmap or
  6.   LoadBitmapFile, into an image, which can be drawn by PutImage.
  7.  
  8.   Supported are 16-color video modes, and monochrome and 16-color
  9.   bitmaps. Monochrome bitmaps use ForeColor and BakColor.
  10.  
  11.   Instead of Graph's PutImage procedure, we recommend using the
  12.   one implemented in our VgaMem unit: It performs correct clipping.
  13. }
  14.  
  15. interface
  16.  
  17. uses WinRes;
  18.  
  19. var
  20.   ForeColor, BakColor: Byte;
  21.  
  22. function BitmapToImage(Bitmap: PBitmap): pointer;
  23.  
  24. implementation
  25.  
  26. uses Graph;    { for ImageSize }
  27.  
  28. procedure DoBitmapToImage_16(Bitmap: PBitmap; Image: pointer;
  29.   Color: Word); near; external;
  30.  
  31. {$L bmp.obj (bmp.asm) }
  32.  
  33. function BitmapToImage(Bitmap: PBitmap): pointer;
  34. var
  35.   Image: pointer;
  36. Begin
  37.   with Bitmap^ do Begin
  38.     GetMem(Image, ImageSize(0, 0, bmWidth-1, bmHeight-1));
  39.     If Image <> nil then
  40.       DoBitmapToImage_16(Bitmap, Image, ForeColor + 256 * BakColor)
  41.   End;
  42.   BitmapToImage := Image
  43. End;
  44.  
  45. end.
  46.